Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sconstruct: correctly detect the language of xliff files when trying to skip English #17143

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

michaelDCurran
Copy link
Member

@michaelDCurran michaelDCurran commented Sep 9, 2024

Link to issue number:

None.

Summary of the issue:

The NVDA build system creates html from markdown files. For any language other than English, these markdown files should be themselves generated from xliff files.
However, a rather strange and incorrect line of code caused this to also happen for English, as the line was not correctly detecting the language.

Description of user facing changes

English user documentation in alpha builds should be based on the very latest markdown files, rather than the last beta from the previous release.

Description of development approach

Fix the questionable line.

Testing strategy:

  • Ensure English userGuide.xliff is newer than userguide.md.
  • Build English userGuide.html
  • Ensure this does not cause userguide.md to be re-generated from userGuide.xliff.
  • Check the English what's new artifact to ensure it has an entry for 2025.1.

Known issues with pull request:

None known.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

Summary by CodeRabbit

  • New Features

    • Improved language detection for localized files by extracting language information from the directory path, enhancing localization accuracy.
  • Bug Fixes

    • Addressed potential issues with language identification that could arise from changes in directory structure.

@michaelDCurran michaelDCurran requested a review from a team as a code owner September 9, 2024 08:12
@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Sep 10, 2024
Copy link
Member

@seanbudd seanbudd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this go to beta?

@SaschaCowley
Copy link
Member

SaschaCowley commented Sep 10, 2024

I have verified that the generated changes file has a section on 2025.1 (I also checked that the correct changes file was included with the launcher).

@michaelDCurran
Copy link
Member Author

michaelDCurran commented Sep 10, 2024 via email

Copy link
Contributor

coderabbitai bot commented Sep 10, 2024

Walkthrough

The pull request modifies the method used to extract the language from the file path of localized .xliff files. The previous implementation relied on splitting the file name, while the new approach utilizes the directory name containing the file. This change aims to enhance the accuracy of language detection by focusing on the directory structure instead of the file name.

Changes

File(s) Change Summary
sconstruct Updated language extraction logic from file name to directory name in .xliff file handling.

Tip

New review model

We have updated our review workflow to use the Anthropic's Claude family of models. Please share any feedback in the discussion post on our Discord.


New features

Walkthrough comment now includes:

  • Possibly related PRs: A list of potentially related PRs to help you recall past context.
  • Suggested labels: CodeRabbit can now suggest labels by learning from your past PRs. You can also provide custom labeling instructions in the UI or configuration file.

Notes:

  • Please share any feedback in the discussion post on our Discord.
  • Possibly related PRs, automatic label suggestions based on past PRs, learnings, and possibly related issues require data opt-in (enabled by default).

Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1b68639 and 48a497b.

Files selected for processing (1)
  • sconstruct (1 hunks)
Additional context used
Path-based instructions (1)
sconstruct (1)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious. When providing code suggestions, particularly when requested, ensure GitHub's suggestion format is used, i.e.: suggestion <code changes>

Additional comments not posted (1)
sconstruct (1)

338-338: LGTM!

The change to extract the language from the directory name instead of the file name is a good improvement. It enhances the robustness of language detection and could lead to more accurate localization handling.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@michaelDCurran michaelDCurran changed the base branch from master to beta September 10, 2024 02:48
@michaelDCurran
Copy link
Member Author

This is now based on beta.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
sconstruct (1)

338-338: Incorrect directory structure assumption for xliff files

The current implementation assumes that xliff files are directly under a directory named after the language. However, they are actually located under user_docs/<lang>/filename.xliff. This discrepancy will cause the language extraction logic to fail, as it will extract user_docs instead of the actual language code.

  • Update the language extraction logic to account for the additional directory level. Consider modifying the code to correctly extract the language from the path user_docs/<lang>/filename.xliff.
Analysis chain

Verify the directory structure assumption for xliff files.

The change to extract the language from the directory name is approved.

However, please verify that all the xliff files in the codebase follow the expected directory structure <lang>/filename.xliff. If there are any xliff files that don't adhere to this structure, the language detection could fail.

You can use the following script to verify the directory structure assumption:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all xliff files follow the directory structure `<lang>/filename.xliff`

# Test: Find all xliff files and check their paths. Expect: All xliff files to be in a directory named after the language.
find . -name "*.xliff" | while read -r xliffFile; do
  if [[ "$xliffFile" =~ \./([^/]+)/[^/]+\.xliff$ ]]; then
    echo "OK: $xliffFile"
  else
    echo "ERROR: $xliffFile does not follow the expected directory structure."
  fi
done

Length of output: 10054

@seanbudd seanbudd merged commit d8d8eb9 into beta Sep 10, 2024
5 checks passed
@seanbudd seanbudd deleted the noEnglishXliff branch September 10, 2024 04:19
@github-actions github-actions bot added this to the 2025.1 milestone Sep 10, 2024
@seanbudd seanbudd modified the milestones: 2025.1, 2024.4 Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants